package com.yungu.swift.report.base;

import com.yungu.swift.report.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ProcessTask {

    @Autowired
    private ConfigService configService;

    /**
     * 执行存储过程(小时)
     */
    @Scheduled(cron = "0 0 * * * *")
    public void runHourProcess() {
        log.info("报表统计小时任务开始");
        configService.processReportConfig(1);
        log.info("报表统计小时任务结束");
    }

    /**
     * 执行存储过程(天)
     */
    @Scheduled(cron = "0 0 3 * * *")
    public void runDayProcess() {
        log.info("报表统计天任务开始");
        configService.processReportConfig(2);
        log.info("报表统计天任务结束");
    }


    /**
     * 执行存储过程(分钟) 测试专用
     */
    //@Scheduled(cron = "0 * * * * *")
    public void runMinProcess() {
        log.debug("报表统计分钟任务开始");
        configService.processReportConfig(3);
        log.debug("报表统计分钟任务结束");
    }

}
